package com.blb.community.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.blb.community.converter.LogininforStatusConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统访问记录
 * </p>
 *
 * @author 帅帅
 * @since 2022-07-02
 */
@TableName("sys_logininfor")
@ApiModel(value = "SysLogininfor对象", description = "系统访问记录")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SysLogininfor implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("访问ID")
    @TableId(value = "info_id", type = IdType.AUTO)
    @ExcelProperty("编号")
    private Long infoId;

    @ApiModelProperty("用户账号")
    @ExcelProperty("用户名称")
    private String userName;

    @ApiModelProperty("登录IP地址")
    @ExcelProperty("登录地址")
    private String ipaddr;

    @ExcelProperty("登录地点")
    @ApiModelProperty("登录地点")
    private String loginLocation;

    @ApiModelProperty("浏览器类型")
    @ExcelProperty("浏览器")
    private String browser;

    @ApiModelProperty("操作系统")
    @ExcelProperty("操作系统")
    private String os;

    @ApiModelProperty("登录状态（0成功 1失败）")
    @ExcelProperty(value = "登录状态",converter = LogininforStatusConverter.class)
    private String status;

    @ApiModelProperty("提示消息")
    @ExcelProperty("提示消息")
    private String msg;

    @ApiModelProperty("访问时间")
    @ExcelProperty("访问时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime loginTime;

    @ApiModelProperty("逻辑删除")
    @TableLogic
    @ExcelIgnore
    private String delFlag;

    @TableField(exist = false)
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private LocalDateTime beginTime;

    @TableField(exist = false)
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private LocalDateTime endTime;
}
